package com.kitbox.hl.meshow.datadic.rest;

import com.kitbox.hl.meshow.common.rest.AbsResponseWapper;
import com.kitbox.hl.meshow.common.rest.SuccessWapper;
import com.kitbox.hl.meshow.datadic.service.DataDicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

/**
 * @Auther: honglei
 * @Date: 2019/8/21 15:53
 * @Description:
 */
@RequestMapping("/kitbox/datadic/api/")
@RestController
public class DataDicRestController {
    @Autowired
    private DataDicService dataDicService;

    @GetMapping("findDataDicPage")
    public AbsResponseWapper findDataDicPage(String groud){
        List<Map> mapList=dataDicService.queryDataDic(groud);
        return new SuccessWapper(mapList);
    }

    @GetMapping("findDataDic")
    public AbsResponseWapper findDataDic(String groud,String vCode){
        Map map=dataDicService.queryDataDic(groud,vCode);
        return new SuccessWapper(map);
    }

    @PostMapping("updateOrInsertDataDic")
    public AbsResponseWapper updateOrInsertDataDic(Map map){
        int count=dataDicService.updateOrinsert(map);
        return new SuccessWapper(count);
    }


}
